<?php
/**
 * Created by PhpStorm.
 * User: Dave
 * Date: 2018/8/24
 * Time: 16:26
 */

use Biz\service\activity\MealInfo as sMealInfo;

/**
 * @deprecated
 */
class ComputeMealTotalAction extends ActionPlugin
{

    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {

        $mealId = $this->getRequest()->getQuery('meal_id');
        $skuIds = $this->getRequest()->getQuery('sku_ids');

        if(empty($skuIds) || empty($mealId)) {
            throw new \Exception('请求参数异常');
        }

        $skuIds = explode(',', $skuIds);

        $mealRebate = sMealInfo::getMealRebateAndPriceByMealId($mealId, $skuIds);
        $result = sMealInfo::computeMealPrice($mealRebate);
        $this->setSuccess($result);
    }
}